package com.bawei.module_video_hall.mvi.repository

import com.bawei.lib_net.RetrofitFactory
import com.bawei.module_video_hall.http.VideoHallApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

/**
 *@author：lxy
 *@decription:
 *@time：2025/6/23
 */
class VideoHallRepository @Inject constructor() {

    private val mApi: VideoHallApi by lazy {
        RetrofitFactory.getRetrofitFactory().create(VideoHallApi::class.java)
    }

    /**
     * 获取放映厅视频类型信息
     */
    fun getMultiType() = flow {
        emit(mApi.getMultiType())
    }.flowOn(Dispatchers.IO)

    /**
     * 获取推荐视频
     */
    fun getRecommendVideo(page: Int, pageSize: Int) = flow {
        emit(mApi.getRecommendVideo(page, pageSize))
    }.flowOn(Dispatchers.IO)

    /**
     * 点击题目切换
     */
    fun getMultiVideoByTypeId(page: Int, pageSize: Int, typeId: Int) = flow {
        emit(mApi.getMultiVideoByTypeId(page, pageSize, typeId))
    }.flowOn(Dispatchers.IO)
}